package com.community.shop.entity.vo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.community.shop.converter.CustomCreateTime;
import com.community.shop.converter.CustomDelFlagConverter;
import com.community.shop.converter.CustomStatusConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Getter
@Setter
@EqualsAndHashCode
/**
 * 商品sku读取vo
 */
public class GoodSkuVo {

    @ExcelProperty("编号")
    private Integer id;
    /**
     * 商品id
     */
    @ExcelProperty("商品主键")
    private Integer goodId;
    /**
     * sku名称
     */
    @ExcelProperty("名称")
    private String skuName;
    /**
     * 样式图
     */
    @ExcelProperty("样式图")
    private String imageUrl;
    /**
     * 价格
     */
    @ExcelProperty("价格")
    private Double price;
    /**
     * 库存
     */
    @ExcelProperty("库存")
    private Integer num;
    /**
     * 状态
     */
    @ExcelProperty(value = "状态",converter = CustomStatusConverter.class)
    private Integer status;
    /**
     * 创建时间
     */
    @ExcelProperty(value = "创建时间",converter = CustomCreateTime.class)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;
    /**
     * 创建人
     */
    @ExcelProperty("创建人")
    private String createBy;
    /**
     * 修改人
     */
    @ExcelIgnore
    private Integer updateBy;
    /**
     * 修改时间
     */
    @ExcelIgnore
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;
    /**
     * 逻辑删除
     */
    @ExcelProperty(value = "逻辑删除",converter = CustomDelFlagConverter.class)
    private Integer delFlag;

    @Override
    public String toString() {
        return "GoodSkuVo{" +
                "id=" + id +
                ", goodId=" + goodId +
                ", skuName='" + skuName + '\'' +
                ", imageUrl='" + imageUrl + '\'' +
                ", price=" + price +
                ", num=" + num +
                ", status=" + status +
                ", createTime=" + createTime +
                ", createBy='" + createBy + '\'' +
                ", updateBy=" + updateBy +
                ", updateTime=" + updateTime +
                ", delFlag=" + delFlag +
                '}';
    }

    public GoodSkuVo() {
    }

    public GoodSkuVo(Integer id, Integer goodId, String skuName, String imageUrl, Double price, Integer num, Integer status, Date createTime, String createBy, Integer updateBy, Date updateTime, Integer delFlag) {
        this.id = id;
        this.goodId = goodId;
        this.skuName = skuName;
        this.imageUrl = imageUrl;
        this.price = price;
        this.num = num;
        this.status = status;
        this.createTime = createTime;
        this.createBy = createBy;
        this.updateBy = updateBy;
        this.updateTime = updateTime;
        this.delFlag = delFlag;
    }
}
